//package com.example.demo.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.SchedulingConfigurer;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
//import org.springframework.scheduling.config.ScheduledTaskRegistrar;
//
///**
// * 线程池
// * @author : Zhang.yt
// * @date : 2023/9/14
// */
//@Configuration
//public class ScheduledTaskConfiguration implements SchedulingConfigurer {
//    @Override
//    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
//        final ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
//        taskScheduler.setPoolSize(50);
//        taskScheduler.initialize();
//        taskScheduler.setThreadNamePrefix("taskExecutor-");   // 线程名称
//        taskScheduler.setAwaitTerminationSeconds(60);         // 等待时长
//        taskScheduler.setWaitForTasksToCompleteOnShutdown(true);  // 调度器shutdown被调用时等待当前被调度的任务完成
//        taskRegistrar.setTaskScheduler(taskScheduler);
//    }
//}
